Skip to content

[server] Implement consumer offset fetches - #5138

Merged
wuchong merged 3 commits into
apache:mainfrom
pisceslj:feature/fip-53-server-fetch-consumer-offsets
Nov 13, 2026
Merged

wuchong merged 3 commits into
apache:mainfrom
pisceslj:feature/fip-53-server-fetch-consumer-offsets

Conversation

@pisceslj

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #5137

Part of #4608.

Implement server-side consumer-offset fetches so clients can read committed offsets for all buckets or selected source-table buckets.

Brief change log

  • Implement GET_CONSUMER_OFFSETS in TabletServer.
  • Decode all-offset and selected-bucket requests and build responses grouped by table.
  • Read committed offsets from the local leader replica.
  • Reorder the consumer-offset primary key to record_type, group_id, table_id, partition_id, bucket_id and scan by record_type + group_id.
  • Create a schema-aware ValueDecoder to read old and new value schemas together.
  • Require DESCRIBE permission on every source table named in a selected-bucket request.
  • Defer all-offset group-level authorization until the separate consumer-group ACL PR lands.
  • Add unit, RPC, and integration tests for all and selected reads, mixed schema versions, authorization, and partitioned/non-partitioned tables.
  • Update the authorization documentation.

Tests

Targeted Maven verification completed for fluss-server and its reactor dependencies. Checkstyle, Spotless, RAT, and git diff --check passed.

  • ConsumerGroupManagerFetchTest: 3 cases
  • ConsumerOffsetFetchITCase: 2 cases
  • ConsumerOffsetFetchAuthorizationITCase: 1 case
  • ConsumerOffsetTableITCase: 2 cases
  • ConsumerOffsetCommitITCase: 1 case
  • ConsumerOffsetSchemaTest: 11 cases
  • TabletServiceTest: 8 cases
  • ServerRpcMessageUtilsTest: 19 cases

All 47 distinct cases passed.

API and Format

No RPC schema changes are introduced by this PR. The consumer-offset table primary-key order changes to record_type, group_id, table_id, partition_id, bucket_id, and prefix scans use record_type + group_id.

Documentation

Updates website/docs/security/authorization.md with GET_CONSUMER_OFFSETS permission semantics.

Implement the server side of GET_CONSUMER_OFFSETS. Decode all-offset and selected-bucket requests, read committed offsets from the local leader replica, and group the response by source table.

Move record_type ahead of group_id in the consumer-offset primary key and scan committed offsets by the (record_type, group_id) prefix. Decode values through the schema getter so old and new value schemas can be read together.

Require DESCRIBE permission on every source table named by a selected-bucket request. All-offset requests defer group-level authorization until the consumer-group ACL work lands.

Add unit, RPC, and integration tests for selected and all-offset reads, mixed schema versions, authorization, and partitioned and non-partitioned buckets. Update the authorization documentation.
Run consumer offset fetches directly on the RPC worker thread and use the
replica-owned schema getter for value decoding. Remove the cached schema
getter and decoder fields from ConsumerGroupManager.

Order the consumer-offset schema and primary-key encoders with record_type
before group_id, and use the same key order for group lookups.

Add a non-retriable InvalidRequestException mapped to Errors.INVALID_REQUEST.
Use it for invalid GetConsumerOffsets combinations and duplicate table buckets
so clients receive a request-level error instead of UNKNOWN_SERVER_ERROR.

Update schema, RPC, and integration tests for the refined key order, error
mapping, and direct fetch behavior.
Cache the decoder with its schema getter so repeated fetches reuse row decoders. Publish both together so concurrent fetches use the matching getter.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 26/26
AI-Contributed/UT: 16/16
Comment on lines +447 to +448
ValueDecoder decoder =
ConsumerOffsetSchema.createValueDecoder(offsetsReplica.getSchemaGetter());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should cache this in ConsumerGroupManager. I'm sorry, I think the previous implementation of getValueDecoder is correct.

@wuchong
wuchong merged commit fe2f5f3 into apache:main Nov 13, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[server] Implement consumer offset fetches

2 participants